local yanyu = fk.CreateSkill {
  name = "lvshi__yanyu",
  tags = {"ready_skill"}
}

Fk:loadTranslationTable{
  ["lvshi__yanyu"] = "焱狱",
  ["#ls__yanyu_prohibit"] = "焱狱",
  [":lvshi__yanyu"] = "<a href='diy_ready_skill'>蓄势技</a>，出牌阶段，你可展示任意张花色各不同的手牌，视为使用等量张【火攻】，且你于结算中不能弃置其余牌。",
  ["#lvshi__yanyu"] = "焱狱：你可视为使用【火攻】（剩余%arg次）",
  ["#lvshi__yanyu_trigger"] = "你可展示任意张花色各不同的手牌，视为使用等量张【火攻】",
  --["@@lvshi_readying:::lvshi__yanyu"] = "焱狱行置",

  ["$lvshi__yanyu1"] = "燃起来吧！",
  ["$lvshi__yanyu2"] = "弹指间，灰飞烟灭！",
}

local DIY = require "packages/diy_utility/diy_utility"

yanyu:addEffect("active", {
  anim_type = "offensive",
  prompt = "#lvshi__yanyu_trigger",
  target_num = 0,
  min_card_num = 1,
  can_use = function(self, player)
    return not DIY.isReadying(player, yanyu.name) and not player:isKongcheng()
  end,
  card_filter = function(self, player, to_select, selected)
    if table.contains(player:getCardIds("h"), to_select) then
      local card = Fk:getCardById(to_select)
      return card.suit ~= Card.NoSuit and table.every(selected, function (id) return card.suit ~= Fk:getCardById(id).suit end)
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    player:showCards(effect.cards)
    room:setPlayerMark(player, "yanyu-prohibit", effect.cards)
    for i = 1, #effect.cards do
      local n = #effect.cards + 1 - i
      local params = {
        name = "lvshi__fire_attack",
        prompt = "#lvshi__yanyu:::"..n,
        skill_name = yanyu.name,
      }
      if not room:askToUseVirtualCard(player, params) then
        room:setPlayerMark(player, "yanyu-prohibit", 0)
        break
      end
    end
    room:setPlayerMark(player, "yanyu-prohibit", 0)
  end,
})

yanyu:addEffect("prohibit", {
  prohibit_discard = function(self, player, card)
    return #player:getTableMark("yanyu-prohibit") > 0 and not table.contains(player:getTableMark("yanyu-prohibit"), card:getEffectiveId())
  end,
})

return yanyu